package com.kadron.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import com.kadron.base.KVBase;

@Entity
@Table(name = "k_user_img", uniqueConstraints = { @UniqueConstraint(columnNames = { "user_id" }) })
public class UserImage extends KVBase implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4157810933951962596L;
	
	private String name;
	private String path;
	private String thumb;
	private long userId;
	
	public UserImage() {
		super();
	}
	
	public UserImage(long userId) {
		this();
		this.userId = userId;
	}

	@Column(name = "user_id", nullable = false)
	public long getUserId() {
		return userId;
	}

	public void setUserId(long userId) {
		this.userId = userId;
	}

	@Column(name = "name", nullable = false)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "path", nullable = false)
	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	@Column(name = "thumb")
	public String getThumb() {
		return thumb;
	}

	public void setThumb(String thumb) {
		this.thumb = thumb;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + (int) (id ^ (id >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UserImage other = (UserImage) obj;
		if (id != other.id)
			return false;
		return true;
	}
}